<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>

  <style>
    .editor {
      height: 400px;
      padding: 12px;
      border: 1px solid;
      overflow: auto;
    }
  </style>
</head>

<body>
  <div class="editor"></div>

  <button id="btn-node">node</button>

  <button id="clear">clear</button>
</body>

<script type="module">
  import { Caret } from '../dist/index.js'

  const editor = document.querySelector('.editor')

  const caret = new Caret(editor)

  const nodeBtn = document.querySelector('#btn-node')

  const clearBtn = document.querySelector('#clear')

  nodeBtn.addEventListener('click', () => {
    const node = document.createElement('div')

    node.innerHTML = 'Hello Word'

    caret.insertNode(node)
  })

  clearBtn.addEventListener('click', () => {
    editor.innerHTML = ''
  })
</script>

</html>